package com.woshua.vptabmodel;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.woshua.vptabmodel.fragment.SplashFragment;
import com.woshua.vptabmodel.transformer.ScaleTransformer;

public class SplashActivity extends AppCompatActivity {

    private ViewPager vpContent;

    private int[] resIds={R.drawable.image_startone,R.drawable.image_starttwo,
            R.drawable.image_startthree,R.drawable.image_startfour};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        vpContent=findViewById(R.id.vpContent);

        vpContent.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int i) {
                return SplashFragment.newInstance(resIds[i]);
            }

            @Override
            public int getCount() {
                return resIds.length;
            }
        });

        vpContent.setPageTransformer(false,new ScaleTransformer());
    }
}
